<!DOCTYPE html>
<html lang="en">
	<head>
		<title> New Document </title>
		<meta charset="utf-8">
		<meta name="Author" content="">
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!-- Bootstrap -->
		<link href="${webRoot}resources/css/bootstrap.min.css" rel="stylesheet" media="screen">
		<link href="${webRoot}resources/css/style.css" rel="stylesheet">
		<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
	</head>
<body class="main">
	<div class="wrap add-shop">
	<ul class="breadcrumb">
		    <li><span id="test">您当前的位置：</span></li>
		    <li class="active">${addGoods}</li>
	    </ul>
		<form class="form-horizontal" method="post"
			enctype="multipart/form-data"
			action="${webRoot}goods/addGoodsInfo.do" id="goodsInfo">
		 <div class="control-group">
		    <label class="control-label" for="shop_id">所属商家</label>
		    <div class="controls">
				<select id="shop_id" name="shop_id">
				<#list shops as shopEntity>
				  <option value="${shopEntity.id}">${shopEntity.name}</option>
				 </#list>
				</select>
		    </div>
		  </div>	
		  <div class="control-group">
		    <label class="control-label" for="name">商品名称</label>
		    <div class="controls">
		      <input type="text" id="name" name="name">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="price">商品价格</label>
		    <div class="controls">
		      <input type="number" id="price" name="price">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="size">商品尺寸</label>
		    <div class="controls">
		      <input type="text" id="size" name="size">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="uplabel_id">商品分类</label>
		    <div class="controls">
				<select id="uplabel_id" name="uplabel_id">
				<option value="">请选择</option>
				  <#list goodslabels as labelEntity>
				  <option value="${labelEntity.label_id}">${labelEntity.label_name}</option>
				 </#list>
				</select>
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="label_id">材料分类</label>
		    <div class="controls">
				<select id="label_id" name="label_id">
				<option value="">请选择</option>
				  <#list stufflabels as labelEntity>
				  <option value="${labelEntity.label_id}">${labelEntity.label_name}</option>
				 </#list>
				</select>
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="content">商品简介</label>
		    <div class="controls">
		      <textarea rows="3" id="content" name="content"></textarea>
		    </div>
		  </div>
		  <div class="control-group">
				<label class="control-label" for="file1">商品图片</label>
				<div class="controls">
					<input type="file" id="file1" name="file">
					<div class="preview1">
						<img src="">
					</div>
				</div>
			</div> 
			<div class="control-group">
				<label class="control-label" for="file2">商品图片</label>
				<div class="controls">
					<input type="file" id="file2" name="file">
					<div class="preview2">
						<img src="">
					</div>
				</div>
			</div>  		
			<div class="control-group">
				<label class="control-label" for="file3">商品图片</label>
				<div class="controls">
					<input type="file" id="file3" name="file">
					<div class="preview3">
						<img src="">
					</div>
				</div>
			</div>  		
			<div class="control-group">
				<label class="control-label" for="file4">商品图片</label>
				<div class="controls">
					<input type="file" id="file4" name="file">
					<div class="preview4">
						<img src="">
					</div>
				</div>
			</div>  		
			<div class="control-group">
				<label class="control-label" for="file5">商品图片</label>
				<div class="controls">
					<input type="file" id="file5" name="file">
					<div class="preview5">
						<img src="">
					</div>
				</div>
			</div>  		
			<div class="control-group">
				<label class="control-label" for="file6">商品图片</label>
				<div class="controls">
					<input type="file" id="file6" name="file">
					<div class="preview6">
						<img src="">
					</div>
				</div>
			</div>  		
			<div class="control-group">
				<label class="control-label" for="file7">商品图片</label>
				<div class="controls">
					<input type="file" id="file7" name="file">
					<div class="preview7">
						<img src="">
					</div>
				</div>
			</div>  		
			<div class="control-group">
				<label class="control-label" for="file8">商品图片</label>
				<div class="controls">
					<input type="file" id="file8" name="file">
					<div class="preview8">
						<img src="">
					</div>
				</div>
			</div>  		 		    
		  <div class="control-group">
		    <div class="controls">
		      <button type="button" class="btn" onclick="checkContext()">确认添加</button>
		    </div>
		  </div>
		</form>			 	
	</div>			
	<script src="${webRoot}resources/js/jquery-1.9.1.min.js"></script>
	<script src="${webRoot}resources/js/bootstrap.min.js"></script>
	<script src="${webRoot}resources/js/js.js"></script>
    <script type="text/javascript">
        function getLabelList(){
        	var uplabel = $("#uplabel_id").val();
        	if(uplabel!=null&&uplabel!=''){
        	$.ajax({url:"${webRoot}goods/getLabelList.do?uplabelId="+uplabel,
			   type:"post",
			   cache:"false",
			   error : function() {
				   alert("系统繁忙，请稍后再试！");
				},
			   success:function(msg){
				   $("#labelId").html(msg);
			   }
			});
        	}else{
        		$("#label_id").val("");
        	}
        }
        
        function checkContext(){
        	var goodsName = $("#name").val();
        	if($.trim(goodsName) == null ||$.trim(goodsName) =="" ){
        		alert("商品名字不能为空！");
        		return;
        	}
        	var goodsJingdu= $("#price").val();
        	if($.trim(goodsJingdu) == null ||$.trim(goodsJingdu) =="" ){
        		alert("商品价格不能为空！");
        		return;
        	}
        	var size= $("#size").val();
        	if($.trim(size) == null ||$.trim(size) =="" ){
        		alert("商品尺寸不能为空！");
        		return;
        	}
        	var uplabelId= $("#uplabel_id").val();
        	if($.trim(uplabelId) == null ||$.trim(uplabelId) =="" ){
        		alert("商铺所属大分类不能为空！");
        		return;
        	}
        	var labelId= $("#label_id").val();
        	if($.trim(labelId) == null ||$.trim(labelId) =="" ){
        		alert("商铺所属小分类不能为空！");
        		return;
        	}
        	var goods_Desc= $("#content").val();
        	if($.trim(goods_Desc) == null ||$.trim(goods_Desc) =="" ){
        		alert("商品的简介不能为空！");
        		return;
        	}
        	document.getElementById("goodsInfo").submit();
        }
    </script>

</body>
</html>
